Week 5 HA - birthday_paradox The [birthday paradox](http://en.wikipedia.org/wiki/Birthday_paradox) states that if there are 23 people in a room then there is a slightly...
Week 5 HA - birthday_paradox
The birthday paradox states that if there are 23 people in a room then there is a slightly more than 50:50 chance that at least two of them will have the same birthday. In this exercise you will write a BlueJ project (birthday_paradox) that will help us empirically test this non-intuitive result. Your project will have just one Java classBirthdayParadox. The details of this class are given below:
· BirthdayParadox.java
·
o The following fields:
o
§ int[] days;
§ int numPeople;
§ int times;
o A constructor BirthdayParadox(int numPeople, int numTimes)which takes as input parameters the number of people and the number of times the simulation is to be performed.
o int rndDay() // returns a random day i.e., a random integer from 1..365 (inclusive)
o int once() // perform the simulation once
o void run() // After creating an instance of a BirthdayParadox object using the above constructor invoke the run method to run simulation
Your constructor for BirthdayParadox will take two inputs: the number of people we are testing for and the number of times to repeat the experiment. For each run of the experiment your program will print the number of people it randomly generated before a birthday repeated. It will print the average number of people after completing all the runs. Note that, by default, the BlueJ terminal window will only show the last 50 lines of a program. To show all the lines that are output by your program in the BlueJ terminal window, choose Options and select Unlimited buffering.
Following are two sample outputs of the program:
Output for
1 ---> 65 2 ---> 17 3 ---> 26 4 ---> 32 5 ---> 17 ... 96 ---> 47 97 ---> 27 98 ---> 15 99 ---> 22 100 ---> 24
Avg ---> 24.4
| Output for
1 ---> 89 2 ---> 40 3 ---> 98 4 ---> 36 5 ---> 38 ... 196 ---> 79 197 ---> 54 198 ---> 87 199 ---> 144 200 ---> 83
Avg ---> 86.7
|
12 years ago
15
Purchase the answer to view it

- jbirthdayparadox.zip
- They have over 50 sales agents across multiple states. They have decided to
- Project Management Lifecycle
- Stats homework and lab for Assignment Expert
- Supply Chain Design Paper
- Grant Writing Basics- 750-1000 words
- Eco 545 week 3 Solved All 10 questions
- Toxicology
- Statistics
- Make a modern day New England Primer. Please.
- QNT 561 Week 5 All DQs + Practice Problems + Learning Team Reflection (Latest Update)